<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<%--
  Created by IntelliJ IDEA.
  User: gz
  Date: 2025/02/17
  Time: 14:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setAttribute("sports", new String[]{"打篮球", "踢足球"});
    ArrayList<String> list = new ArrayList<>();
    list.add("q");
    list.add("w");
    list.add("e");
    list.add("r");
    request.setAttribute("list",list);
%>
<h1>第一种遍历方式</h1>
<ul>
    <c:forEach begin="1" end="5" var="i">
        <li>
            排名${i}
        </li>
    </c:forEach>
</ul>
<h1>第二种遍历方式</h1>
<c:forEach items="${requestScope.sports}" var="sport">
运动名称=${sport} <br>
</c:forEach>
<h1>第三种遍历方式</h1>
<c:forEach items="${requestScope.list}" var="key">
键位:${key} <br>
</c:forEach>
<%--
    还有一种对象数组或map类型的
--%>
</body>
</html>
